<?php
$this->pageHeader = t('PAGE_TITLE', 'menu');
$this->pageTitle = t('PAGE_TITLE', 'menu');
$toolbar = new LGToolbar();
$toolbar->buttonNewPage(t('PAGE_TITLE_ADDNEW', 'menu'), '', app()->controller->id . '/create');
//$toolbar->publishList();
//$toolbar->unpublishList();
$toolbar->buttonDelete();
$toolbar->buttonRefresh(t('BTN_REFRESH'), t('BTN_REFRESH'), url(app()->controller->id . '/refresh'));
$this->pageToolbar = $toolbar->mergeToolbar();


$this->breadcrumbs = array(t('MENU_MANAGEMENT'), t('LBL_MENU_TYPE', 'menuType') => url('menutype'), 'Menu Item' => array('index'));
?>                             
<div class="search-form"> 														
    <?php
    $this->renderPartial('_search', array(
	'model' => $model,
    ));
    ?>
</div>
<!-- grid -->
<?php
$dataProvider = Menu::getProductTypeTreeDataProvider($model, LGHelpers::getPageSize($model->count()));
$this->widget('GridView', array(
    'id' => 'DataGrid',
    'dataProvider' => $dataProvider,
    'itemsCssClass' => 'grid',
    'summaryText' => LGHelpers::getSummary(),
    'columns' => array(
	array(
	    'header' => '#',
	    'class' => 'CCheckBoxColumn',
	    'selectableRows' => '2',
	    'id' => 'chkId',
	    'htmlOptions' => array('width' => '20px', 'align' => 'center'),
	),
//        array(
//            'header' => t('LBL_TITLE', 'menu'),
//            'value' => '"<span class=\"indent\">".$data["indent"]."</span>" 
//                    . CHtml::link(CHtml::encode($data["title"]), "", array("href" => Yii::app()->controller->createUrl("update", array("id" => $data["id"]))
//                    , "id" => $data["id"], "style"=>"cursor:pointer"))
//                    . "<p class=\"smallsub\">"
//                    . "<span class=\"indent-hidden\">".$data["indent"]."</span>"
//                    . "(<span>" . t("LBL_ALIAS", "menu") . "</span>: " . $data["alias"] . ")</p>" ',
//            'type' => 'raw',
//        ),
	array('name' => 'name',
	    'value' => 'app()->controller->getMenuDisplayName($data)',
	    'type' => 'raw',
	    'htmlOptions' => array(
	    )),
	array(
	    'name' => 'status',
	    'header' => t('LBL_STATUS', 'menu'),
	    'value' => 'Html::active($data["id"],$data["status"],"active")',
	    'htmlOptions' => array('width' => '20px', 'align' => 'center'),
	    'type' => 'raw',
	    'sortable' => false,
	),
//        array(
//            'value' => '"<span class=\"display_order\">".$data["display_order"]."</span>". $data["order_column"]',
//            'header' => t('LBL_DISPLAY_ORDER', 'menu'),
//            'htmlOptions' => array('width' => '80px', 'align' => 'center'),
//            'type' => 'raw',
//        ),
	array('name' => 'display_order',
	    'value' => 'app()->controller->getHtmlDownButtonOfProductImage($data).app()->controller->getHtmlUpButtonOfProductImage($data)',
	    'type' => 'raw',
	    'sortable' => false,
	    'htmlOptions' => array(
		'style' => 'width:57px;text-align: center'
	    )),
	array(
	    'value' => 'CHtml::encode($data["access"])',
	    'header' => t('LBL_ACCESS', 'menu'),
	    'htmlOptions' => array('width' => '120px', 'align' => 'center'),
	    'type' => 'raw',
	),
	array(
	    'value' => 'CHtml::encode($data->extension->name)',
	    'header' => t('LBL_TYPE', 'menu'),
	    'htmlOptions' => array('width' => '120px', 'align' => 'center'),
	    'type' => 'raw',
	),
	array(
	    'value' => 'Html::defaultPage($data["id"], $data["default_page"], "setdefaultpage", t("LBL_DEFAULT", "menu"), t("LBL_SET_DEFAULT", "menu"))',
	    'header' => t('LBL_DEFAULT_PAGE', 'menu'),
	    'htmlOptions' => array('width' => '20px', 'align' => 'center'),
	    'type' => 'raw',
	),
	array(
	    'value' => 'LGHelpers::getLanguage($data["language"])',
	    'header' => t('LBL_LANGUAGE', 'menu'),
	    'htmlOptions' => array('width' => '20px', 'align' => 'center'),
	    'type' => 'raw',
	),
	array(
	    'value' => '$data["id"]',
	    'header' => t('LBL_ID', 'menu'),
	    'htmlOptions' => array('width' => '20px', 'align' => 'center'),
	    'type' => 'raw',
	),
	array(
	    'header' => t('LBL_ACTION', 'menu'),
	    'htmlOptions' => array('width' => '20px', 'align' => 'center'),
	    'class' => 'ArticleButtonColumn',
	    'template' => "{update}",
	    'buttons' => array(
		'update' => array('url' => 'Yii::app()->controller->createUrl("update", array("id" => $data["id"]))'),
	    )
	)
    ),
));
?>
<script type="text/javascript">
    $(document).ready(function() {
	ShowTooltip($(".tooltip"), $("#shareit-box"), "<?php echo url("menu/gettooltip"); ?>");
    });
</script>
